/*
Description
Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplication, exponentiation by a non-negative integer is defined in the normal way: a^0 = "" (the empty string) and a^(n+1) = a*(a^n).
Input
Each test case is a line of input representing s, a string of printable characters. The length of s will be at least 1 and will not exceed 1 million characters. A line containing a period follows the last test case.
Output
For each s you should print the largest n such that s = a^n for some string a.
Sample Input
abcd
aaaa
ababab
.
Sample Output
1
4
3
Hint
This problem has huge input, use scanf instead of cin to avoid time limit exceed.
题意：给定一个字符串，求出它最多由几个相同的连续子串连接而成。
*/
#include <string>
#include <algorithm>
#include <cstdio>
#include <iostream>
#define ll long long
#define PI acos(-1)
#define M(n, m) memset(n, m, sizeof(n));
const int INF = 1e9 + 7;
const int maxn = 1e6 + 10;
using namespace std;
string str;
int len, _next[maxn];

void get_next()
{
    len = str.size();
    int i = 0, j = -1;
    _next[0] = -1;
    while(i < len)
    {
        if (j == -1 || str[i] == str[j])
        {
            i ++;
            j ++;
            _next[i] = j;
        }
        else
            j = _next[j];
    }
}

int main()
{
    while(cin >> str)
    {
        if (str == ".")
            break;
        get_next();
        // _next[len] 中存储的是模式串中出现重复的最长长度
        // k即为可能出现的循环节的长度
        int k = len - _next[len];
        /*
        如果不能整除，则说明不存在循环节，只能由它本身组成串
        例如 abcab 此时的 _next[len] = 2, 不能整除，观察也可以发现循环节的个数只能是1
        */
        if (len % k == 0)
            cout << (len / k) << endl;
        else
            cout << "1" << endl;
    }
    return 0;
}
